<template>
	<view class="u-p-30">
		<view class="container ">
			<view class="scroll-item" v-for="(item, rowIndex) in dataList" :key="rowIndex" @click="handle(item)">
				<view class="icon-container">
					<image :src="item.groupImage" mode="aspectFill" style="border-radius: 50%;width: 40px;height: 40px;" ></image>
				<!-- <image src="https://img14.360buyimg.com/pop/jfs/t1/235820/35/21147/137736/6671ad05Ffbb78c7f/d07dcf0eb1ac62a0.png" mode="widthFix" /> -->
					
				</view>
				<view class="name-container">
					{{ item.groupName || '' }}
				</view>
			</view> 
		</view> 
	</view> 
</template> 
<script>
	export default {
		data() {
			return {
				dataList: [{
						name: '饿了么',
						icon: 'index1.png',
						type: '01'
					},
					{
						name: '美团',
						icon: 'index2.png',
						type: '02'
					}, {
						name: '搭车出行',
						icon: 'index3.png',
						type: '03'
					}, {
						name: '特惠酒店',
						icon: 'index4.png',
						type: '04'
					}, {
						name: '电影票',
						icon: 'index5.png',
						type: '05'
					},
					{
						name: '快递优惠',
						icon: 'index6.png',
						type: '06'
					},
					{
						name: '连锁餐饮',
						icon: 'index7.png',
						type: '07'
					}, {
						name: '本地生活',
						icon: 'index8.png',
						type: '08'
					}, {
						name: '电商',
						icon: 'index9.png',
						type: '09'
					},
					{
						name: '卡券',
						icon: 'index10.png',
						type: '10'
					}
				],

			};
		},
		onShow() {
			this.getGroupList()
		},
		methods: {
			handle(item){
				uni.$u.route('pages/category/kadetails',{
					groupId:item.groupId
				})
				
			},
			getGroupList(){
				this.$api.getGroupListApi().then(res=>{
					console.log(res);
					this.dataList = res.data
				})
			}
		},
	};
</script>

<style lang="scss">
	.container {
		display: flex;
		flex-wrap: wrap;
	}



	.scroll-item {
		text-align:center;
		width: 25%;
		display: flex;
		justify-content: center;
		flex-direction: column;
		align-items: center;
		margin-bottom: 10px;
	}

	.item {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		width: 20%;
		box-sizing: border-box;
		text-align: center;
		padding: 10px;
		margin: 5px;
	}

	.icon-container {
		width: 50px;
		height: 50px;
		margin-bottom: 5px;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 50%;
	}

	.icon {
		width: 100%;
		height: 100%;
	}

	.name-container {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.indicators {
		display: flex;
		justify-content: center;
		margin-top: 10px;
		width: 100%;
	}

	.indicator-bar {
		display: flex;
		width: 80%;
		height: 5px;
		background-color: #ccc;
		border-radius: 2.5px;
		overflow: hidden;
	}

	.indicator {
		flex: 1;
		height: 100%;
	}

	.indicator.active {
		background-color: #007aff;
	}
</style>